x86_emulate: honor failure of in_longmode()
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 31 Aug 2009 08:54:25 +0000 (09:54 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 31 Aug 2009 08:54:25 +0000 (09:54 +0100)
Failure of in_longmode() shouldn't be treated the same as the function
returning 'true'.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen/arch/x86/x86_emulate/x86_emulate.c

index 5f8361e2b2c24ad01de948678d98ec7d75b7f740..f2dfdf0c19e4ccbea9e362629385d5770ba78a56 100644 (file)
@@ -3605,7 +3605,10 @@ x86_emulate(
         ss.attr.bytes = 0xc93; /* G+DB+P+S+Data */
 
 #ifdef __x86_64__
-        if ( in_longmode(ctxt, ops) )
+        rc = in_longmode(ctxt, ops);
+        if ( rc < 0 )
+            goto cannot_emulate;
+        if ( rc )
         {
             cs.attr.fields.db = 0;
             cs.attr.fields.l = 1;
@@ -3777,7 +3780,10 @@ x86_emulate(
         ss.limit = ~0u;  /* 4GB limit */
         ss.attr.bytes = 0xc93; /* G+DB+P+S+Data */
 
-        if ( in_longmode(ctxt, ops) )
+        rc = in_longmode(ctxt, ops);
+        if ( rc < 0 )
+            goto cannot_emulate;
+        if ( rc )
         {
             cs.attr.fields.db = 0;
             cs.attr.fields.l = 1;